/*
 * Copyright (c) 2025 Industrial Software Feature Database
 */
package com.comac.ins.isfd.controller;


import cn.dev33.satoken.annotation.SaCheckPermission;
import com.comac.ins.common.core.domain.R;
import com.comac.ins.common.web.core.BaseController;
import com.comac.ins.isfd.domain.vo.IsfdCollectRoundHistoryVo;
import com.comac.ins.isfd.service.IIsfdCollectRoundHistoryService;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 机型轮次历史记录-采集
 *
 * @author hxloongs
 * @date 2025-03-24
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/isfd/collectRoundHistory")
public class IsfdCollectRoundHistoryController extends BaseController {

    @Autowired
    private IIsfdCollectRoundHistoryService isfdCollectRoundHistoryService;

    /**
     * 根据机型获取历史上传的轮次号
     */
    @SaCheckPermission("isfd:collectRoundHistory:list")
    @GetMapping("/list")
    public R<List<String>> roundHistoryList(@RequestParam("modelNumber") String modelNumber) {
        return R.ok(isfdCollectRoundHistoryService.roundHistoryList(modelNumber));
    }


    /**
     * 获取机型轮次历史记录-采集详细信息
     *
     * @param id 主键
     */
    @SaCheckPermission("isfd:collectRoundHistory:query")
    @GetMapping("/{id}")
    public R<IsfdCollectRoundHistoryVo> getInfo(@NotNull(message = "主键不能为空")
                                                @PathVariable Long id) {
        return R.ok(isfdCollectRoundHistoryService.queryById(id));
    }
}
